import java.util.Scanner;

/**
 * 用户服务
 *
 * @author yuwei
 * @date 21:01 2024/4/24
 */
public class accountManage {
    public static void change() {
        System.out.println("--交易--");
        System.out.println("交易内容");
        Scanner scan = new Scanner(System.in);
        String title = scan.next();
        System.out.println("交易金额");
        int money = scan.nextInt();
        accountTable.accounts.add(new account(money, title));
        accountTable.total += money;
    }

    public static void show() {
        System.out.println("        账单          ");
        System.out.println("-----------------------");
        accountTable.accounts.forEach(i -> System.out.println(i));
        if(accountTable.accounts.size()==0){
            System.out.println("    无任何数据 ");
        }
        System.out.println("总额  " + accountTable.total);
    }

    public static void menu() {
        System.out.println("---收支管理----");
        System.out.println("1.查看账单");
        System.out.println("2.交易");
        System.out.println("3.返回");
        Scanner scanner = new Scanner(System.in);
        switch (scanner.nextInt()) {
            case 1:
                show();
                menu();
                break;
            case 2:
                change();
                menu();
                break;
            case 3:
                system.finance();
            default:
                System.out.println("输入错误");
                menu();
        }
    }

}
